package com.freight.user.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.freight.core.base.FreightBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.ColumnTransformer;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * @author huyingtai
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "user_driver_license")
@TableName("user_driver_license")
@ApiModel(value = "驾驶证")
public class DriverLicense extends FreightBaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "驾驶证号")
    @ColumnTransformer(read = "AES_DECRYPT(UNHEX(num),'freight')", write = "HEX(AES_ENCRYPT(?, 'freight'))")
    private String num;

    @ApiModelProperty(value = "驾驶证准驾车型")
    private String driverType;

    @ApiModelProperty(value = "发证机关")
    private String issuingOrganizations;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "初次领证日期")
    private Date issueDate;

    @ApiModelProperty(value = "驾照证正面地址")
    private String driverFontPicFileID;

    @ApiModelProperty(value = "从业资格证文件id")
    private String workLicensePicFileId;


}